<?php 
namespace Emos\Field;

use Emos\Common;

class CKEditor extends Textarea {
    protected $toolbar = 'Normal';
    static $customConfig = '/emos/js/ckeditor_config.js';

    public function setToolbar($toolbar = 'Normal') {
        $this->toolbar = $toolbar;
        return $this;
    }

    public function html() {
        $_SESSION['enable_filemanager'] = true;
        return "<textarea name='{$this->htmlName}' class='ckeditor' data-customConfig='".self::$customConfig."' data-toolbar='{$this->toolbar}'>".Common::plain($this->value)."</textarea>";
    }
}